var rootURL=getRootPath();
var id=window.sessionStorage.getItem("id");

$(document).ready(function () {
    if(window.sessionStorage.getItem("managername")==null||window.sessionStorage.getItem("managername")==""){
        alert("请先登录！");
        window.location.href=rootURL+"/html/index.html";
    }else{
        $('.embed-responsive').hide();
        $("#welcome").append(window.sessionStorage.getItem("managername"));
        $.ajax({
            type:"post",
            url:rootURL+"/selmenuM",
            async:true,
            data:{
                managerid:id
            },
            success:function(menuM){
                $('#treeview1').treeview({
                    data: menuM,
                    backColor:"#35404d",
                    showBorder:false,
                    onhoverColor:"#35404d",
                    onNodeSelected: function (event, data) {
                        if(data.href=="/html/statistics.html"){
                            $('#main').show();
                            $('#addhtml').hide();
                        }else{
                            $('#main').hide();
                            $('#addhtml').show();
                            $('iframe').attr('src',rootURL+data.href);
                        }
                    }
                });
            }
        });
        $("#qute").click(function(){
            window.sessionStorage.setItem("id","");
            window.sessionStorage.setItem('managername', "");
            window.location.href=rootURL+"/html/index.html";
        });
    }
});